package com.binc.testspring.common.utils;

import java.util.ArrayList;
import java.util.List;

public class BinaryNumberUtils {
    public BinaryNumberUtils() {
    }

    public static List<Long> splitToLog(long value) {
        List<Long> splitValue = new ArrayList();
        long j = 1L;

        do {
            if ((value & j) == j) {
                splitValue.add(j);
            }

            j <<= 1;
        } while(j <= value);

        return splitValue;
    }

    public static List<Integer> splitToInt(Long value) {
        List<Integer> splitValue = new ArrayList();
        int j = 1;

        do {
            if ((value & (long)j) == (long)j) {
                splitValue.add(j);
            }

            j <<= 1;
        } while((long)j <= value);

        return splitValue;
    }

    public static boolean intOnBin(long a, long b) {
        return (a & b) == b;
    }

    public static void main(String[] args) {
        System.out.println(splitToInt(8L));
    }
}
